#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>

int main() {
    const char *fifoPath = "my_fifo";
    
    // 创建命名管道
    mkfifo(fifoPath, 0666);

    int fd = open(fifoPath, O_WRONLY); // 打开管道以写入数据

    char message[] = "Hello from named pipe!";
    write(fd, message, strlen(message) + 1);

    close(fd); // 关闭文件描述符

    return 0;
}
